/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dao;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.faces.bean.ManagedBean;
import org.hibernate.Criteria;
import org.hibernate.Session;
import pojo.CAutonomaPOJO;

/**
 *
 * @author BAENA
 */

@ManagedBean
public class CAutonomaDAO {
    
    public static List<CAutonomaPOJO> getListaCAutonomas() {
        List<CAutonomaPOJO> listaCAutonomas = new ArrayList<CAutonomaPOJO>();
        Session session = ConfHibernate.getSessionFactory().getCurrentSession();        
        try {
            session.beginTransaction();
            Criteria criteria = session.createCriteria(CAutonomaPOJO.class);
            listaCAutonomas = criteria.list();
            session.getTransaction().commit();
        } catch (Exception ex) {
            Logger.getLogger(CAutonomaDAO.class.getName()).log(Level.SEVERE,"Problema al obtener la lista de Juegos");
            session.getTransaction().rollback();
        }
        return listaCAutonomas;
    }
}
